﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Demo05</title>
    <style type="text/css">
        h2, h3 {
            text-align: center;
        }

        .MyTable {
            margin: 10px auto;
            border-collapse: collapse;
        }
    </style>
</head>
<body>
    <h2>按照部门编号分组显示员工信息 （只查询平均工资在5000及以上的组）linq</h2>
    @foreach (var myList in ViewBag.listLinq)
    {
        @foreach (var item in myList)
        {
            <h3>部门编号：@item.DeptId</h3>
            break;
        }
        <table width="1000" border="1" class="MyTable">
            <tr>
                <th>员工编号</th>
                <th>部门编号</th>
                <th>员工姓名</th>
                <th>员工电话</th>
                <th>员工工资</th>
            </tr>
            @foreach (var item in myList)
            {
                <tr>
                    <td>@item.EmpId</td>
                    <td>@item.DeptId</td>
                    <td>@item.EmpName</td>
                    <td>@item.EmpPhone</td>
                    <td>@item.EmpSalary</td>
                </tr>
            }
        </table>
    }
   
    <h2>按照部门编号分组显示员工信息 （只查询平均工资在5000及以上的组）lambda</h2>
    @foreach (var myList in ViewBag.listLambda)
    {
        @foreach (var item in myList)
        {
            <h3>部门编号：@item.DeptId</h3>
            break;
        }
        <table width="1000" border="1" class="MyTable">
            <tr>
                <th>员工编号</th>
                <th>部门编号</th>
                <th>员工姓名</th>
                <th>员工电话</th>
                <th>员工工资</th>
            </tr>
            @foreach (var item in myList)
            {
                <tr>
                    <td>@item.EmpId</td>
                    <td>@item.DeptId</td>
                    <td>@item.EmpName</td>
                    <td>@item.EmpPhone</td>
                    <td>@item.EmpSalary</td>
                </tr>
            }
        </table>
    }
</body>
</html>
